Repository navigation
Stop mise-install from clobbering a user's own wrapper - #13243
Raj-Jagadeesh-A-P wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The guard matched a file on any one line a generated wrapper carries, so a user's own wrapper ending in `exec "/path/to/tool" "$@"` or `exec mise x tool@1.2 -- tool "$@"` was still replaced. It now rebuilds each form the script has ever written from the package the file names and the bin being installed, and requires the whole file to equal one of them, so an extra argument, a redirect, another command or a retargeted binary marks it as the user's. The package is taken from the file rather than the call because callers do switch a command's package (grok moved from npm to mise's own); the bin no caller has ever changed. Refusing with exit 1 also stopped omarchy-migrate: migrations run under `bash -e` and omarchy-migrate stops at the first failure, so a migration installing a command the user already has would have stalled every migration after it on every update. Leaving the user's file is the intended outcome, so it now exits 0 with a note on stderr. A directory in the way still fails, since it leaves no command at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed and run on a disposable Omarchy VM. The bug in #7101 is real: on
I also added cases to What ran on the VM: the new test passes at ec125cd and fails against both Codex (medium effort) gave a second opinion over four rounds. It found the near-match wrappers, the retargeted binary and a directory in the way being reported as success. Each is fixed in the pushed commit, and its last round found nothing further. It may have read this review's own reasoning, so its agreement is not fully independent. Waiting on the maintainer. The branch forked from an older |
|
| named_package=$(sed -n 's/^mise use -g \(--quiet \)\{0,1\}\(.*\)$/\2/p' <<<"$contents") | ||
| named_package=${named_package% || exit 1} | ||
| exec_line=$(sed -n 's/^exec \(.*\) "\$@"$/\1/p' <<<"$contents") | ||
| named_bin=${exec_line#mise x "$named_package" -- } | ||
| named_bin=${named_bin#mise exec "$named_package" -- } | ||
| [[ $named_package =~ $token ]] || return 1 | ||
| [[ $named_bin == "\"$bin\"" || $named_bin == "$(printf '%q' "$bin")" ]] || return 1 |
There was a problem hiding this comment.
Pinned wrappers can be replaced A user can pin a version by changing the package in a generated wrapper to
claude@2.0.1 while keeping its format. This check reads the package from that file but compares only the binary name with the install request. It then treats the wrapper as Omarchy-owned and replaces the user's pinned version with the requested package.
Knowledge Base Used: System updates and migrations
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| rm -f "$target" | ||
| elif [[ -f $target ]]; then | ||
| echo "omarchy-mise-install: leaving $target alone, it is not a mise wrapper" >&2 | ||
| exit 0 |
There was a problem hiding this comment.
Skipped installs report success When a user-owned file occupies the command path, this branch leaves it untouched but exits successfully without installing the requested wrapper. A migration that relies on the exit status can then be marked complete even though the install was skipped. The PR description also says this case should exit nonzero.
| exit 0 | |
| exit 1 |
Knowledge Base Used: System updates and migrations
|
Heads-up: #14539, opened today, fixes the same #7101 bug in |
Fixes #7101.
omarchy-mise-install removed ~/.local/bin/ unconditionally before writing its shim. For a user's own wrapper at the same path — pinning a version, or pointing the tool at a custom API base URL — that silently destroyed their setup on every update/migration.
It now refuses to touch anything that is not a mise wrapper: